$(function(){
	var tableSource = new $.jqx.dataAdapter({
		dataType: "json",
		dataFields:[
//	        { name: "id", type: "int" },
	        { name: "uuid", type: "string" },
		    { name: "couponName", type: "string" },
		    { name: "amount", type: "string" },
		    { name: "requirementAmount", type: "string" },
		    { name: "userName", type: "string" },
		    { name: "isUsed", type: "string" },
		    { name: "receiveDate", type: "string" },
		    { name: "useDate", type: "string" },
		],
//		id: "id",
		url: "coupon/platFormCouponDetails.do"
	});
	$("#dataTable").jqxDataTable({
		width: "100%",
        source: tableSource,
        pageable: true,
        serverProcessing: true,
        pageSize: 18,
        pagerButtonsCount: 10,
        columnsResize: true,
        sortable: true,
        columns: [
            { text: "序号", width: '16.7%', cellsRenderer: function(row) {  return (row + 1).toString(); } },
            { text: "优惠券名称", dataField: "couponName", width: '16.7%'},
            { text: "金额", dataField: "amount", width: '16.7%' },
            { text: "满减", dataField: "requirementAmount", width: '16.7%'},
            { text: "领取用户", dataField: "userName", width: '10%'},
            { text: "是否使用", dataField: "isUsed", width: '10%'},
            { text: "使用时间", dataField: "useDate", width: '10%'},
            { text: "领用时间", dataField: "receiveDate", width: '10%'}
        ],
	});
	$("#dataTable").on();
	/*$("#dataTable").on("rowDoubleClick",function(info, args){
		if(args && args.flag){
			info = args;
		}
		editingIndex = info.args.index;
		editingData = info.args.row;
	 	_editerIndex = layer.open({
			id: "sellerEditer",
			title: "Banner",
		    type: 1,
		    skin: 'layui-layer-rim',
		    area: ['1000px', '640px'],
		    content: 
	    			'<form id="coupon-editer" class="form" method="post" style="height: 100%;overflow: auto;">' +
				    '<div id="order_editer" class="form" style="overflow: auto;">' +
					'<label class="from-label" for="couponName">优惠券名称：</label>' +
					'<input type="text" name="couponName" allowBlank="false" class="form-control" placeholder="优惠券名称" readonly="readonly" />' +
					'<label class="from-label" for="amount">金额：</label>' +
					'<input type="text" id="amount" name="amount" allowBlank="false" class="form-control" placeholder="金额" readonly="readonly" />' +
					'<label class="from-label" for="requirementAmount">满减：</label>' +
					'<input type="text" id="requirementAmount" name="requirementAmount" allowBlank="false" class="form-control" placeholder="满减" readonly="readonly" />' +
					'<label class="from-label" for="userName">领取用户：</label>' +
					'<input type="text" id="userName" name="userName" allowBlank="false" class="form-control" placeholder="领取用户" readonly="readonly" />' +
					'<label class="from-label" for="isUsed">是否使用：</label>' +
					'<input type="text" id="isUsed" name="isUsed" allowBlank="false" class="form-control" placeholder="是否使用" readonly="readonly" />' +
					'<div class="input-box"><label class="from-label" for="receiveDate">领取时间：</label>' +
					'<div name="startDate" allowBlank="true" readonly="readonly" placeholder="领取时间" id="receiveDate" style="display: inline-block;margin:10px 0;vertical-align:middle"></div></div>' +
					'<div class="input-box"><label class="from-label" for="useDate">使用时间：</label>' +
					'<div name="endDate" allowBlank="true" readonly="readonly" placeholder="使用时间" id="useDate" style="display: inline-block;margin:10px 0;vertical-align:middle"></div>' +
					'</div>' +
					'<div id="detailed-datatable"' +
					'	style="border-radius: 0; min-height: 500px; margin: 0 0 0 32px;"></div>' +
					'<br> <br> <br>' +
					'</form>'+
					'<div class="form" style="position: absolute;bottom: 0px;width: 100%;text-align: right;background-color: #DDD;">' +
		    		'<input type="button" class="btn btn-sm btn-info" onclick="closeEditer(this, true)" value="返回"/>' +
		    		'</div>'
				});
		 		$("#receiveDate").jqxDateTimeInput({ width: "200px", height: "34px", formatString: "yyyy-MM-dd", value: null });
				$("#useDate").jqxDateTimeInput({ width: "200px", height: "34px", formatString: "yyyy-MM-dd", value: null });
			 	$("input[name='id']").val(editingData['id']);
			 	setData($("#coupon-editer"), editingData);
			 	setAmounts(editingData);
	});*/
});


function setAmounts(data){
	$("#amount").val(data.amount);
	$("#requirementAmount").val(data.requirementAmount);
	$("#couponNum").val(data.couponNum);
}